home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / PROG914.ZIP / PROGRAM.DOC < prev    next >
Text File  |  1994-01-27  |  56KB  |  1,324 lines

  1. PROGRAM.DOC                 by:  Ira F. Kavaler - March & April, 1987
  2. Version 9.14 - 1/27/94
  3.  
  4.  
  5.      The BASIC Language PROGRAM Generator.
  6.      -------------------------------------
  7.  
  8.      I love teaching technical subjects, but I'm not a teacher.  I'm an
  9. electrical engineer by trade.  While receiving my higher education I
  10. despised computers.  I was a radio man;  a "ham" (amateur radio)
  11. operator.  Based on these early tendencies my first block of technical
  12. training after high school came from RCA Institutes in New York City.
  13. At RCA I took their Advanced Technologies course (T-3) which consisted
  14. of nine terms;  the first eight were straight forward Mathematics
  15. (Calculus), English, Science (Physics), Industrial Engineering, and
  16. Electrical and Electronic Theory.  The ninth, and last, term was
  17. specialization in either Communications Technology or Computer Science.
  18. Of course, I elected communications!  I and my classmates called the
  19. computer kids, "button pushers"!
  20.  
  21.      After graduating from RCA I decided to get my EE degree, so I went
  22. to The Polytechnic Institute of Brooklyn, now masquerading as The
  23. Polytechnic University of New York.
  24.  
  25.      In 1963, while attending Poly, I happened into my public library
  26. one day and, for lack of something better to read, I checked-out a book
  27. on computer programming in machine language.  The book was in the RCA
  28. Tutor Series, which was supposed to be a self-learning text;  and it
  29. was!
  30.  
  31.      Within days I was writing machine language program for a computer
  32. I didn't even have access to.  I was converted to a "button pusher".
  33. The next semester I enrolled in computer classes; Poly had a total of
  34. two:  Computer Techniques and Mathematical Techniques;  the latter had
  35. very little to do with programming.  The language taught was Fortran
  36. IV, and I was writing programs within a day.  My professor couldn't
  37. follow the subject matter, complexity, nor logic of my programs by the
  38. second week.
  39.  
  40.      As a class project, I proved by computer simulation that broadcast
  41. color television standards set in the 1950's were wrong;  the
  42. modulation compression limits established by the broadcast industry and
  43. the FCC were incorrect.
  44.  
  45.      A second class project was a business inventory and ordering
  46. program for my family's paint business.
  47.  
  48.      By the next semester (1964) my guidance counselor realized my
  49. potential (after "being hit over the head with pleas for computer
  50. time"), so he got me a National Science Foundation grant, and
  51. sponsorship by NASA to do computer programming research.  My primary
  52. project was to develop a program to digest vacuum tube and transistor
  53. specifications and characteristic curves for the design of electronic
  54. circuits.  I was very successful, having been offered positions by many
  55. large computer companies upon graduation.
  56.  
  57.      I was given access to the newly installed IBM 7040 System, and
  58. time sharing system connected to the GE Datanet, using Darthmouth
  59. BASIC, FORTRAN and ALGOL languages.  When Poly replaced the 7040 System
  60. with a new System / 360, I wrote many of the library functions for its
  61. APL (Inversion) language.
  62.  
  63.      While still a student at Poly I started teaching computer
  64. programming classes in additional to the advanced communications
  65. technologies classes I was conducting.  I was so successful in getting
  66. other students interested in computer programming that I started
  67. teaching programming to pre-teenagers in my neighborhood.
  68.  
  69.      Upon graduation my family did not was me to move out of New York
  70. City, so I turned down a very lucrative offer by IBM and got a job with
  71. the government;  my mother wanted me to have a secure job, and she was
  72. right!
  73.  
  74.      I was always striving to discover the perfect teaching method;
  75. something I'm still trying to do.  My teaching techniques progressed to
  76. the point that I could teach a person to write a simple program within
  77. one hour using the six primitive BASIC commands:  LET, INPUT, PRINT,
  78. GOTO, IF...THEN, and END.
  79.  
  80.      When I finally got my first home computer* in 1979 (and I resisted
  81. getting one for many years) I was on my way to unlimited computer time.
  82. A couple of years later my boss arranged to get me an IBM XT system.
  83.  
  84.      (* My first machine was a Super Elf 1802 microprocessor on a
  85. single board, followed months later by a TRS-80 Model I, which I still
  86. have in perfect operating condition, amongst other early computer
  87. systems I've been collecting over the years.)
  88.  
  89.      I tough an interesting project would be to write a program that
  90. would allow non-programmers to write fully functional BASIC language
  91. programs with extremely minimal training.  To that goal I wrote the
  92. program "PROGRAM", which in 1987 was called simply "PGM".
  93.  
  94.  
  95.      Some terms I used.
  96.      ------------------
  97.  
  98.      I tried to explain each of the selections in the two menus:
  99. Instruction and Action.  At one point I was stumped!  How do I describe
  100. altering the processing path to go back to an earlier point on the
  101. program, or to jump ahead to a later point in the program?  I decided
  102. to call the point, either earlier or later, in the program a
  103. "signpost";  it identifies a referenced line number.  To identify the
  104. point you erect a signpost.
  105.  
  106.      The term I used to go to the signpost was "detour".  When writing
  107. a program you will usually decide to detour to a signpost that has not
  108. been erected yet.  That's OK, PROGRAM will ask for an inscription
  109. (label) for that signpost, and use that inscription until it determines
  110. the actual location of the signpost.  If you happen to erect the
  111. signpost first, the inscription is still used when any detours to that
  112. signpost are encountered.
  113.  
  114.  
  115.      Let's try to write a program in BASIC using PROGRAM.
  116.      ----------------------------------------------------
  117.  
  118.      One of the problem I like to teach as a programming example is the
  119. calculation of the amount of wallpaper required for a room.  Having
  120. worked in the paint industry for fifteen years while going to school, I
  121. have discovered the vast majority of people do not know how to
  122. determine how much area a single roll of wallpaper will cover.  The
  123. following program development will yield a stand alone BASIC program to
  124. solve this problem.
  125.  
  126.      First read the other documentation file supplied with this
  127. package.  It contains the problem broken down into a series of simple
  128. steps.  From these simple steps you can draw a simple flow chart that
  129. will diagram these steps.  The diagram should look similar to the
  130. following:
  131.  
  132.                               ┌─────────┐
  133. I have drawn this with        │  START  │    No command required
  134. only rectangles as            └────┬────┘
  135. limited by my word                 │
  136. processor and printer.      ┌──────┴──────┐
  137.                             │  ASK WIDTH  │    Call it W
  138.                             │   INPUT W   │
  139.                             └──────┬──────┘
  140.                                    │
  141.                             ┌──────┴───────┐
  142.                             │  ASK LENGTH  │    Call it L
  143.                             │   INPUT L    │
  144.                             └──────┬───────┘
  145.                                    │
  146.                        ┌───────────┴───────────┐
  147.                        │  CALCULATE PERIMETER  │    Call it P
  148.                        │       P=2*L+2*W       │
  149.                        └───────────┬───────────┘
  150.                                    │
  151.                             ┌──────┴───────┐
  152.                             │  ASK HEIGHT  │    Call it H
  153.                             │   INPUT H    │
  154.                             └──────┬───────┘
  155.                                    │
  156.                           ┌────────┴─────────┐
  157.                           │  CALCULATE AREA  │    Call it A
  158.                           │      A=P*H       │
  159.                           └────────┬─────────┘
  160.                                    │
  161.                          ┌─────────┴─────────┐
  162.                          │     CALCULATE     │    The gov't requires
  163.                          │  NUMBER OF ROLLS  │    30 sq.ft. of paper
  164.                          │       N=A/30